<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    // 函数的策略模式
    var strategies = {
        "S":function (salary) {
            return salary*4;
        },
        "A":function (salary) {
            return salary*3;
        },
        "C":function (salary) {
            return salary*2;
        }
    };
    var calculateBonus = function (level, salary) {
        return strategies[level](salary)
    }
    console.log(calculateBonus("S",20000));
</script>
</body>
</html>